// Copyright (c) 2002 Torvald Riegel. All rights reserved.
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.

package cpne;

import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;
import org.tigris.gef.presentation.*;

public class FigPlaceNode extends FigNode
{
    private Fig circle, p1, p2, p3, p4;
    private FigText label;
    
    public FigPlaceNode()
        {
            super();
            circle = new FigCircle(-20, -20, 40, 40, Color.black, Color.white);
            p1 = new FigCircle(-30, -30, 60, 60, Color.red, Color.red);
            //p1 = new FigCircle(15, -5, 10, 10, Color.red, Color.red);
            //p2 = new FigCircle(-5, -25, 10, 10, Color.red, Color.red);
            //p3 = new FigCircle(-25, -5, 10, 10, Color.red, Color.red);
            //p4 = new FigCircle(-5, 15, 10, 10, Color.red, Color.red);
            label = new FigText(-10, -10, 20, 20);
            label.setLineWidth(0);
            label.setJustification(FigText.JUSTIFY_CENTER);
            label.setEditable(true);
            addFig(p1);
            addFig(circle);
            //addFig(p1);
            //addFig(p2);
            //addFig(p3);
            //addFig(p4);
            addFig(label);
            setBlinkPorts(true);
        }
    public void setOwner(Object owner)
        {
            super.setOwner(owner);
            PlaceNode pn = (PlaceNode) owner;
            //label.setText(pn.getId());
            label.setText("p");
            bindPort(pn.p1, p1);
            //bindPort(pn.p2, p2);
            //bindPort(pn.p3, p3);
            //bindPort(pn.p4, p4);
        }
    public void mouseClicked(MouseEvent me)
        {
            if (me.getClickCount() > 1)
                label.mouseClicked(me);
        }
    
    public void dispose()
        {
            System.out.println("dispose!");
            super.dispose();
        }
    /** Returns false to prevent resizing */
    public boolean isResizable()
        {
            return false;
        }
    /** Gets the Fig that represents the outer bounds of this node.
     * This is the surrounding circle for place nodes */
    public Fig getBoundsFig()
        {
            return circle;
        }
    
}

